package com.prs.crm.action.document;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.struts.BaseAction;
import org.courser.ui.PaginationSupport;
import org.hibernate.criterion.DetachedCriteria;

import com.prs.crm.domain.document.FileImorodSet;
import com.prs.crm.service.document.FileImorodSetService;

public class FileImorodSetAction extends BaseAction{

	private static final long serialVersionUID = 1L;
		private FileImorodSet fileImorodSet;
		private FileImorodSetService fileImorodSetService;
		private PaginationSupport pagination;
		private Integer[] ids;
		public FileImorodSet getFileImorodSet() {
			return fileImorodSet;
		}
		public void setFileImorodSet(FileImorodSet fileImorodSet) {
			this.fileImorodSet = fileImorodSet;
		}
		public FileImorodSetService getFileImorodSetService() {
			return fileImorodSetService;
		}
		public void setFileImorodSetService(FileImorodSetService fileImorodSetService) {
			this.fileImorodSetService = fileImorodSetService;
		}
		public PaginationSupport getPagination() {
			return pagination;
		}
		public void setPagination(PaginationSupport pagination) {
			this.pagination = pagination;
		}
		public Integer[] getIds() {
			return ids;
		}
		public void setIds(Integer[] ids) {
			this.ids = ids;
		}
		@Action("listFileImorodSet")
		public String listFileImorodSet(){
			DetachedCriteria criteria=this.getPaginationHelper().createQuery(FileImorodSet.class);
			pagination=this.getPaginationHelper().prepare(pagination);
			this.setPagination(this.getFileImorodSetService().listByPage(criteria, pagination));
			return SUCCESS;
		}
		
		@Action("editFileImorodSet")
		public String editFileImorodSet(){
			return SUCCESS;
		}
		@Action(value="saveFileImorodSet",results={
				@Result(name="success",type="redirect",location="listFileImorodSet"),
				@Result(name="error",type="chain",location="editFileImorodSet")
		})
		public String saveFileImorodSet(){
			this.getFileImorodSetService().save(fileImorodSet);
			return SUCCESS;
		}
		@Action(value="removeFileImorodSet",results={
				@Result(name="success",type="redirect",location="listFileImorodSet"),
				@Result(name="error",type="chain",location="listFileImorodSet")
		})
		public String removeFileImorodSet(){
			if (ids==null) {
				this.setPrompt("请选择一行！");
				return ERROR;
			}
			this.getFileImorodSetService().batchRemove(ids);
			return SUCCESS;
		}
}
